import 'package:flutter/material.dart';

class DashboardDemo extends StatefulWidget {
  const DashboardDemo({Key? key}) : super(key: key);

  @override
  _DashboardDemoState createState() => _DashboardDemoState();
}

class DashboardItem {
  IconData icon;
  String title;

  DashboardItem(this.icon, this.title);
}

class _DashboardDemoState extends State<DashboardDemo> {
  List<DashboardItem> _list = [
    DashboardItem(Icons.record_voice_over, "Overview"),
    DashboardItem(Icons.new_releases_outlined, "Releases"),
    DashboardItem(Icons.important_devices_rounded, "Devices"),
    DashboardItem(Icons.watch, "Wear"),
    DashboardItem(Icons.military_tech_sharp, "Technology"),
    DashboardItem(Icons.screen_lock_landscape_sharp, "Large Screens"),
    DashboardItem(Icons.cleaning_services_outlined, "Machine Learning"),
    DashboardItem(Icons.privacy_tip, "Privacy"),
    DashboardItem(Icons.phone_locked, "Android 5G"),
  ];

  @override
  Widget build(BuildContext context) {
    var bgColor = Color.fromRGBO(58, 66, 86, 1.0);
    return Scaffold(
        backgroundColor: bgColor,
        appBar: AppBar(
          backgroundColor: bgColor,
          elevation: 0,
          centerTitle: true,
          title: Text("INDHOLD"),
        ),
        body: Container(
          padding: EdgeInsets.only(left: 16, right: 16, top: 10, bottom: 10),
          child: GridView.builder(
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 2, mainAxisSpacing: 8, crossAxisSpacing: 8),
            itemBuilder: (context, index) {
              var info = _list[index];
              return Card(
                color: Colors.blueGrey.shade100,
                child: InkWell(
                  onTap: () {},
                  splashColor: Colors.lightBlueAccent,
                  highlightColor: Colors.amber,
                  child: Padding(
                    padding: const EdgeInsets.all(10.0),
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Icon(
                          info.icon,
                          color: Colors.lightBlue,
                        ),
                        SizedBox(
                          height: 10,
                        ),
                        Text(info.title)
                      ],
                    ),
                  ),
                ),
              );
            },
            itemCount: _list.length,
          ),
        ));
  }
}
